package org.zero.onlinesubject.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.zero.onlinesubject.common.vo.Result;
import org.zero.onlinesubject.entity.Role;
import org.zero.onlinesubject.service.RoleService;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/role/api")
public class RoleController {

    @Resource
    private RoleService roleService;

    @GetMapping("roleInfo")
    public Result<Role> getRoleById(Integer Id){
        return Result.ok(roleService.getRoleById(Id));
    }

    @GetMapping("roleList")
    public Result<List<Role>> getRoleList(){
        return Result.ok(roleService.getRoleList());
    }
}
